package psn.zjk.spring.diy;

import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
import org.springframework.context.annotation.Primary;
import org.w3c.dom.Element;

/**
 * xml文件加载=》resource=》document=》element=》BeanDefinitionHolder=>BeanDefinition
 * 解析xml前后加入逻辑
 * 张骏凯
 * 2020年1月27日
 */
public class DiyParseXml extends DefaultBeanDefinitionDocumentReader {

    @Override protected void preProcessXml(Element root) {
        super.preProcessXml(root);
    }

    @Override protected void postProcessXml(Element root) {
        super.postProcessXml(root);
    }

    private String generateBeanName() {
        return BeanDefinitionReaderUtils.generateBeanName(new AbstractBeanDefinition() {

            @Override public void setParentName(String parentName) {
            }

            @Override public String getParentName() {
                return null;
            }

            @Override public AbstractBeanDefinition cloneBeanDefinition() {
                return null;
            }
        }, getReaderContext().getRegistry(), true);
    }

}
